package pl.perseus.dao;
 
import java.util.HashMap;
import java.util.Map;

import org.springframework.stereotype.Repository;

import pl.perseus.model.Passlist;
import pl.perseus.model.User;

@Repository
public class PasslistDao extends BaseDao<Passlist> implements IPasslistDao{
 
	
	public PasslistDao() {
		super("Passlist");
	}

	@Override
    public Passlist selectByIdPasslist(Long id) {
    	Map<String, Object> map = new HashMap<String, Object>();
    	map.put("id", id);
        return queryForObject("getByIdPasslist", map);
    }
	
	@Override
	public Passlist insertPasslist(Passlist Passlist){
		return insertBean("insertPasslist", Passlist);
	}
	
	@Override
	public Passlist updatePassList(Passlist passlist){
		return updateBean("updatePasslist", passlist);
	}
 
	@Override
	public void deletePassList(Passlist list){
    	delete("deletePasslist", list);
	}
	
	@Override
	public Passlist getFirstUnusedPassListForUser(User user){
		Map<String, Object> map = new HashMap<String, Object>();
    	map.put("id_user", user.getId());
		return queryForObject("getFirstUnusedPassListForUser", map);
	}
	
}
